package com.steamedfish.auctionitemserver.elasticsearch.entity;

import com.baomidou.mybatisplus.annotation.TableLogic;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author 高山福
 * @since 2021-03-18
 */
@Data
@Document(indexName = "steamed_fish_auction_1",shards = 5,replicas = 1,createIndex = true,type = "auction_item")
public class AuctionItem implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "拍卖品id")
    @Id
    private String id;

    @Field(type = FieldType.Auto)
    @ApiModelProperty(value = "所属用户的id")
    private String userId;

    @Field(type = FieldType.Text)
    @ApiModelProperty(value = "拍卖品名字")
    private String name;


    @Field(type = FieldType.Text,analyzer = "ik_max_work")
    @ApiModelProperty(value = "拍卖品文字描述")
    private String description;

    @Field(type = FieldType.Auto)
    @ApiModelProperty(value = "最低价")
    private BigDecimal lowerPrice;

    @Field(type = FieldType.Auto)
    @ApiModelProperty(value = "指定加价区间")
    private BigDecimal priceStep;

    @Field(type = FieldType.Auto)
    @ApiModelProperty(value = "最高价：可以不用设置")
    private BigDecimal upPrice;

    @Field(type = FieldType.Auto)
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @Field(type = FieldType.Auto)
    @ApiModelProperty(value = "拍卖开始时间")
    private LocalDateTime auctionTime;

    @Field(type = FieldType.Auto)
    @ApiModelProperty(value = "拍卖结束时间")
    private LocalDateTime endTime;

    @Field(type = FieldType.Auto)
    @ApiModelProperty(value = "商品状态：0-正在拍卖，1-已拍卖，-1-等待拍卖")
    private String status;

    @Field(type = FieldType.Auto)
    @ApiModelProperty(value = "指定拍卖类别：0-英式拍卖，1-一口价")
    private String auctionType;

    @Field(type = FieldType.Auto)
    @ApiModelProperty(value = "用于查询图片的id")
    private String itemImageId;

    @Field(type = FieldType.Auto)
    @TableLogic
    @ApiModelProperty(value = "逻辑删除字段：0表示未被删除，1表示删除")
    private String deleted;

    public AuctionItem(){

    }

    public AuctionItem(String id, String userId, String name, String description, BigDecimal lowerPrice, BigDecimal priceStep, BigDecimal upPrice, LocalDateTime createTime, LocalDateTime auctionTime, LocalDateTime endTime, String status, String auctionType, String itemImageId, String deleted) {
        this.id = id;
        this.userId = userId;
        this.name = name;
        this.description = description;
        this.lowerPrice = lowerPrice;
        this.priceStep = priceStep;
        this.upPrice = upPrice;
        this.createTime = createTime;
        this.auctionTime = auctionTime;
        this.endTime = endTime;
        this.status = status;
        this.auctionType = auctionType;
        this.itemImageId = itemImageId;
        this.deleted = deleted;
    }

}
